
// ----------public Func--------------------
//输入验证
function checkLen(obj, id, source) {
    var maxChars;
    if(source == 'mb') {
        if($("#" + id).attr('class').indexOf('mb-inp') >= 0) {
            var maxChars = 5; //最多字符数
        }
    } else {
        if(id.indexOf('fourty') >= 0) {
             maxChars = 40; //最多字符数
        } else if(id.indexOf('taga') >= 0) {
             maxChars = 30; //最多字符数
        } else if(id.indexOf('swin') >= 0) {
             maxChars = 50; //最多字符数
        } else {
             maxChars = 20; //最多字符数
        }
    }

    if($(obj).val().length > maxChars) {
        obj.value = obj.value.substring(0, maxChars);
    } else {

    }

    // if (obj.value.length > maxChars){
    //     obj.value = obj.value.substring(0,maxChars);
    // }
    var curr = $(obj).val().length;
    document.getElementById(id).innerHTML = curr.toString();

    if(curr >= maxChars) {
        $("#" + obj.id).addClass('redBorder');
        // document.getElementById(obj.id).style.borderColor="#f00";//边框颜色#f00
    } else {
        $("#" + obj.id).removeClass('redBorder');
        // document.getElementById(obj.id).style.borderColor="#dcdcdc";//边框颜色
    }
}
$(function(){
    //账户管理鼠标划过换图片
    $('#page-headerRightAccount .dropdown-menu a').on('mouseover',function(){
        var src = $(this).find('img').attr('src');
        switch(src){
            case 'images/account/accountInfo.png':
        $(this).find('img').attr('src','images/account/accountInfo1.png');
            break;
            case 'images/account/accountDetail.png':
        $(this).find('img').attr('src','images/account/accountDetail1.png');
            break;
            case 'images/account/newInvoice.png':
        $(this).find('img').attr('src','images/account/newInvoice1.png');
            break;
            case 'images/account/loginOut.png':
        $(this).find('img').attr('src','images/account/loginOut1.png');
            break;
        }
    }).on('mouseout',function(){
        var src = $(this).find('img').attr('src');
        switch(src){
            case 'images/account/accountInfo1.png':
            $(this).find('img').attr('src','images/account/accountInfo.png');
            break;
            case 'images/account/accountDetail1.png':
            $(this).find('img').attr('src','images/account/accountDetail.png');
            break;
            case 'images/account/newInvoice1.png':
            $(this).find('img').attr('src','images/account/newInvoice.png');
            break;
            case 'images/account/loginOut1.png':
            $(this).find('img').attr('src','images/account/loginOut.png');
            break;
        }
    })
    $('.manuForPageWrap ').on('focusin','.menuBtn',function(){
        $(this).addClass('pageMenuBtnActive').parent().siblings('.pageMenuWrap').find('.menuBtn').removeClass('pageMenuBtnActive');
        return false;
    })



})